//
//  UIImageView+imageViewYMJ.m
//  拉勾7.17
//
//  Created by dllo on 16/7/17.
//  Copyright © 2016年 YMJ. All rights reserved.
//

#import "UIImageView+imageViewYMJ.h"

@implementation UIImageView (imageViewYMJ)
+ (UIImageView *)createBackIcon {
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_back@##3x"]];
    imageView.center = CGPointMake(30, 30);
    return imageView;
}
+ (UIImageView *)createLaGouIcon {
    UIImageView *lagou = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_lagou"]];
    lagou.center = CGPointMake(WIDTH / 2, HEIGHT / 3);
    return lagou;
}
+ (UIImageView *)createBackgroundImageVIew {
    UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"welcome_2"]];
    backgroundImageView.center = CGPointMake(WIDTH / 2, HEIGHT / 2);
    return backgroundImageView;
}
+ (UIImageView *)createPlantsVSZombiesBackgroundFlashImageVIew {
    // 背景backgroundImageView
    UIImageView *backgroundImageView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    [backgroundImageView setImage:[UIImage imageNamed:@"BackGround.png"]];
    // 花 5朵
    for (int i = 0; i < 5; i++) {
        // 花朵图片数组
        NSMutableArray *flowerArray = [NSMutableArray array];
        for (int i = 1; i < 19; i++) {
            UIImage *flowerImage = [UIImage imageNamed:[NSString stringWithFormat:@"flower%d.tiff",i]];
            [flowerArray addObject:flowerImage];
        }
        // 一朵花imageVIew
        UIImageView *flowerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(50, 120 * (i + 1), 60, 70)];
        flowerImageView.animationDuration = flowerArray.count * 1 / 30;
        flowerImageView.animationImages = flowerArray;
        flowerImageView.animationRepeatCount = REPEATCOUNT;
        [flowerImageView startAnimating];
        [backgroundImageView addSubview:flowerImageView];

    }
    // 植物 5只
    for (int i = 0; i < 5; i++) {
        NSMutableArray *plantsArray = [NSMutableArray array];
        for (int i = 1; i < 10; i++) {
            UIImage *plantsImage = [UIImage imageNamed:[NSString stringWithFormat:@"plants%d.tiff",i]];
            [plantsArray addObject:plantsImage];
        }
        UIImageView *plantsImageView = [[UIImageView alloc] initWithFrame:CGRectMake(110, 120 * (i + 1), 90, 100)];
        plantsImageView.animationDuration = plantsArray.count * 1 / 30;
        plantsImageView.animationImages = plantsArray;
        plantsImageView.animationRepeatCount = REPEATCOUNT;
        [plantsImageView startAnimating];
        [backgroundImageView addSubview:plantsImageView];
    }
    // 瓜 5只
    for (int i = 0; i < 5; i++) {
        NSMutableArray *guaArray = [NSMutableArray array];
        for (int i = 1; i < 17; i++) {
            UIImage *guaImage = [UIImage imageNamed:[NSString stringWithFormat:@"gua%d.tiff",i]];
            [guaArray addObject:guaImage];
        }
        UIImageView *guaImageView = [[UIImageView alloc] initWithFrame:CGRectMake(200, 120 * (i + 1), 70, 80)];
        guaImageView.animationDuration = guaArray.count * 1 / 30;
        guaImageView.animationImages = guaArray;
        guaImageView.animationRepeatCount = REPEATCOUNT;
        [guaImageView startAnimating];
        [backgroundImageView addSubview:guaImageView];
    }
    // b僵尸 5只
    for (int i = 0; i < 5; i++) {
        NSMutableArray *bZombieArray = [NSMutableArray array];
        for (int i = 1; i < 26; i++) {
            UIImage *bZombieImage = [UIImage imageNamed:[NSString stringWithFormat:@"BZombie%d.tiff",i]];
            [bZombieArray addObject:bZombieImage];
        }
        UIImageView *bZombieImageView = [[UIImageView alloc] initWithFrame:CGRectMake(280, 120 * (i + 1), 90, 100)];
        bZombieImageView.animationDuration = bZombieArray.count * 1 / 30;
        bZombieImageView.animationImages = bZombieArray;
        bZombieImageView.animationRepeatCount = REPEATCOUNT;
        [bZombieImageView startAnimating];
        [backgroundImageView addSubview:bZombieImageView];
    }
    // 僵尸 5只
    for (int i = 0; i < 5; i++) {
        NSMutableArray *zombieArray = [NSMutableArray array];
        for (int i = 1; i < 22; i++) {
            UIImage *zombieImage = [UIImage imageNamed:[NSString stringWithFormat:@"Zombie%d.tiff",i]];
            [zombieArray addObject:zombieImage];
        }
        UIImageView *zombieImageView = [[UIImageView alloc] initWithFrame:CGRectMake(330, 120 * (i + 1), 90, 100)];
        zombieImageView.animationDuration = zombieArray.count * 1 / 30;
        zombieImageView.animationImages = zombieArray;
        zombieImageView.animationRepeatCount = REPEATCOUNT;
        [zombieImageView startAnimating];
        [backgroundImageView addSubview:zombieImageView];
    }
    return backgroundImageView;
    
}
#pragma mark - UIImageView 是个相册,它内部有个封装的动画方法可以将套图播放出来做成flash
@end
